<?php
namespace app\msgapi\service;
error_reporting(E_ERROR | E_PARSE);
class HuihuaMessageStatisticsService
{

    /**消息统计列表
     * @param $data
     * @return \think\response\Json
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getChatStatisticsLst($data)
    {
        $msg_list = HuihuaMsgService::getYearData($data);
        $user_list = HuihuaCustService::getYearData($data);
        $_msg = array_column($msg_list,'week');
        $_user = array_column($user_list,'week');
        $msg_list = array_column($msg_list,'count','week');
        $user_list = array_column($user_list,'count','week');
//        合并数据
        $tmp = array_diff($_msg,$_user);
        $all = array_merge($_user,$tmp);
        sort($all);
        return success_json('成功',compact('all','msg_list','user_list'));
    }

}